<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
	<title>LOOP: File Stream</title>
	<style type="text/css" media="all"><!--
		@import "../../loop.css";
		@import "../../layout1.css";
	--></style>
</head>

<body>

<div id="Header">Class Models for Lua</div>
<div id="Logo"><img alt="small (1K)" src="../../small.gif" height="70"></div>

<div id="Menu">
<div class="outside"><div class="inside"><ul>
																																																																																																																									<li><a href="../../index.html", title="">Home</a></li>
																																																																																																																									<li><a href="../../release/index.html", title="Installation">Install</a></li>
																																																																																																																									<li><a href="../../manual/index.html", title="User Manual">Manual</a></li>
																																																																																																																									<li><a href="../index.html", title="Class Library">Library</a>
																																																																																																																										<div class="outside"><div class="inside"><ul>
																																																																																																																											<li><a href="../overview.html#collection", title="Collections">collection</a>
																																																																																																																												</li>
																																																																																																																												<li><a href="../overview.html#compiler", title="Compiling">compiler</a>
																																																																																																																													</li>
																																																																																																																													<li><a href="../overview.html#debug", title="Debugging">debug</a>
																																																																																																																														</li>
																																																																																																																														<li><a href="../overview.html#object", title="Objects">object</a>
																																																																																																																															</li>
																																																																																																																															<li><a href="../overview.html#serial", title="Serialization">serial</a>
																																																																																																																																</li>
																																																																																																																																<li><a href="../overview.html#thread", title="Threading">thread</a>
																																																																																																																																	</li>
																																																																																																																																</ul></div></div>
																																																																																																																															</li>
																																																																																																																															<li><a href="../../contact.html", title="Contact People">Contact</a></li>
																																																																																																																															<li><a href="http://luaforge.net/projects/oil/", title="Project at LuaForge">LuaForge</a></li>
																																																																																																																														</ul></div></div>
																																																																																																																													
</div>

<div class="content">
<h1>File Stream</h1>
<h2><code>loop.serial.FileStream</code></h2><br>
<p>Subclass of <code><a href="Serializer.html">Serializer</a></code> that serializes values into a file.
It is also used to restore values serialized in a file using the serialization mechanism provided by <code><a href="Serializer.html">Serializer</a></code>.
This class is useful to implement persitence mechanisms.</p>

<p>Instances of this class implement the <code>write</code> method required by <code><a href="Serializer.html">Serializer</a></code> in such way that the pieces of the serialized code are written directly into the file.</p>

<h2>Behavior</h2>

<h3>Fields</h3>

<dl>
	
	<dt><code><b>buffersize</b></code></dt>
	<dd>
		Maximum number of characters read from the file at each read access to the file.
		By default, this field is 1024.
	</dd>
	
	<dt><code><b>file</b></code> [required]</dt>
	<dd>
		Handler of the file where the serialied code shall be written.
		This handler is also used to read the serialized code used to restore values.
		In this case, the file may contain sequences of serialized values separated by a null character followed by a newline character (<i>i.e.</i> <code>"\0\n"</code>).
	</dd>
	
</dl>

<h3>Methods</h3>

<dl>
	
	<dt><code><b>put</b>(...)</code></dt>
	<dd>
		Serializes the arguments and stores the results in the file defined by field <code>file</code>.
		The sequences of values serialized by this function are terminated by a null character followed by a newline character (<i>i.e.</i> <code>"\0\n"</code>).
	</dd>
	
	<dt><code><b>get</b>()</code></dt>
	<dd>
		Each time this method is called, it restores one of the set of values serialized in the file defined by field <code>file</code>, in the same order they were serialized.
		All the set of values stored in the file defined by field <code>file</code> must be separated by a null character followed by a newline character (<i>i.e.</i> <code>"\0\n"</code>).
	</dd>
	
</dl>

<h2>Remarks</h2>

<ul>
	<li>Methods <code>serialize</code> and <code>load</code> of the superclass <code><a href="Serializer.html">Serializer</a></code> should not be used because they break the serialization policy used by this class.</li>
</ul>

<h2>Examples</h2>

<h3><a name="$ExampleName">$ExampleDescription</a></h3>

<pre>
-- example missing
</pre>

</div>

<div class="content">
<p><small><strong>Copyright (C) 2004-2008 Tecgraf, PUC-Rio</strong></small></p>
<small>This project is currently being maintained by <a href="http://www.tecgraf.puc-rio.br">Tecgraf</a> at <a href="http://www.puc-rio.br">PUC-Rio</a>.</small>
</div>



</body>

</html>
